import api from '@/utils/request'


//登录接口
export const login = (data)=>{
    return api.post('user/login',data)
}

//修改密码
export const repassword =(data)=>{
    return api.post('user/repwd',data)
}

//注册用户
export const registUser = (data)=>{
    return api.post('user/addUser',data)
}

//忘记密码
export const forgetpass =(data) =>{
    return api.post('user/setRedisCodePassword',data)
}
//得到验证码
export const getCode =(data)=>{
    return api.get(`user/getRedisCodePassword/${data}`)
}


// money表接口
//得到用户余额
export const getUserMoney = (data)=>{
    return api.get(`money/getMoney/${data}`)
}

//付款
export const subtractMoney =(data)=>{
    return api.post('money/subMoney',data)
}

//充值
export const addUserMoney = (data)=>{
    return api.post('money/addMoney',data)
}



//根据用户名查询他的地址
export const getUserAddress = (data)=>{
    return api.get(`address/getAddressList/${data}`)
}

//新增地址
export const addUserAddress = (data)=>{
    return api.post('address/addUserAddress',data)
}

//删除地址
export const delUserAddress = (data)=>{
    return api.post('address/delUserAddress',data)
}

//更改地址默认状态
export const updateAddressDefault =(data)=>{
    return api.post('address/updateAddressDefault',data)
}
//根据姓名查询用户
// export const selectByName = (data)=>{
//     return api.get(`user/selectByName/${data}`)
// }


//food食物表
//获得食品分类接口
export const getCategory = (data)=>{
    return api.get(`food/getCategoryFood/${data}`)
}

//搜索功能
export const getCategoryByFoodName =(data)=>{
    return api.get(`food/getCategory/${data}`)
}


//order订单表 添加订单
export const addOrder = (data)=>{
    return api.post("order/addOrder",data)
}

//orderstate 订单状态表
export const addOrderState = (data)=>{
    return api.post("orderstate/addOrder",data)
}
//更改用户状态
export const updateState =(data)=>{
    return api.get(`orderstate/updateState/${data}`)    
}

//得到用户状态
export const getState = (data) =>{
    return api.get(`orderstate/getState/${data}`)
}

//得到已付款的用户列表
export const getAllFinsh =(data)=>{
    return api.get(`orderstate/getStateList/${data}`)
}



//添加充值记录表
export const addChangeMoney = (data)=>{
    return api.post("changemoney/getUserAddMoney",data)
}

//得到充值记录表中的充值记录1
export const getChangeMoney = (data)=>{
    return api.get(`changemoney/getChangeMoney/${data}`)
}

